home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- // FILE: AElatticeRelated.mel
- // INPUT: string (node name)
- // RETURN: string[] (list of related nodes, with the node whose
- // tab you want to be opened duplicated at the
- // end of the array)
- //
-
- global proc string[] AElatticeRelated (string $node)
- {
- string $preferredNode = "";
- string $retval[];
-
- int $ii, $jj;
-
- string $siblings[] = `listRelatives $node`;
-
- string $origNode = "";
- string $flexorNode = "";
-
- // get the siblings which will include a flexor shape if
- // it is a flexor and a non history lattice if it has history
- //
-
- int $len = size($siblings);
- for ($ii = 0; $ii < $len; $ii++) {
-
- string $currSib = $siblings[$ii];
-
- if ("flexorShape" == nodeType($currSib)) {
- $flexorNode = $currSib;
- }
- if ("lattice" == nodeType($currSib)) {
- string $hist[] = `listHistory $currSib`;
- if (size($hist) == 0) {
- $origNode = $currSib;
- }
- }
- }
-
- if ($origNode != "") {
- $retval[size($retval)] = $origNode;
- }
- if ($flexorNode != "") {
- $retval[size($retval)] = $flexorNode;
- }
-
- // look for a connected ffd node
- //
- string $conns[2] = `listConnections -s false ($node+".latticeOutput")`;
- $len = size($conns);
- for ($ii = 0; $ii < $len; $ii++) {
- if ("ffd" == nodeType($conns[$ii])
- || "jointFfd" == nodeType($conns[$ii])) {
- $retval[size($retval)] = $conns[$ii];
-
- // see if there is a locator on the sculpt
- //
- $conns = `listHistory ($conns[$ii]+".baseLatticeMatrix")`;
- int $len = size($conns);
- for ($ii = 0; $ii < $len; $ii++) {
- if ("baseLattice" == nodeType($conns[$ii])) {
- string $parents[] = `listRelatives -p ($conns[$ii])`;
- if (size($parents)) {
- $retval[size($retval)] = $parents[0];
- }
- break;
- }
- }
- break;
- }
- }
-
- // we duplicate this node in the list so that it will be selected
- //
- if ($flexorNode != "") {
- $retval[size($retval)] = $flexorNode;
- }
- else if ($origNode != "") {
- $retval[size($retval)] = $origNode;
- }
-
- if (0 == size($retval)) {
- $retval[0] = $node;
- }
-
- return $retval;
- }
-
-